# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def status_time_ago_in_words(time)
    time_word = time_ago_in_words(time)
    case time_word
    when "less than a minute"
      "刚刚"
    when /minute/
      time_word.gsub(/minutes|minute/,'分钟') + "前"
    when /hour/
      ##time.gsub(/about/,'').gsub(/hours/,'小时') + "前"
      time_word.gsub(/about (\d+) (hours|hour)/, '\1小时') + "前"
    when "1 day"
      "昨天"
    when "2 days"
      "前天"
    when "3 days"
      "3天前"
    else
      time.strftime("%Y年%m月%d %H:%M")
    end
  end
  
end
